import click

from .may_daemon import MayDaemon


@click.group(context_settings={'help_option_names': ['-h', '--help']})
def may():
    """may server"""


@may.command()
@click.option("--debug", "-d", is_flag=True, help="debug mode")
@click.option("--config", "-c", type=click.Path(exists=True), help="specify configuration file")
def start(config, debug):
    pid = MayDaemon().start(config, debug)
    print(pid)


@may.command()
def stop():
    MayDaemon().stop()


@may.command()
def restart(debug):
    MayDaemon().restart()


@may.command()
def status():
    MayDaemon().status()
